package github.kawaiior.yuanchuxiuzhen.common.item.armor;

import github.kawaiior.yuanchuxiuzhen.core.init.itemgroup.YcxzGroup;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.IArmorMaterial;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.World;


import javax.annotation.Nullable;
import java.util.List;

public class ManaStoneArmor extends ArmorItem {

    public static IArmorMaterial getIArmorMaterial(int level){
        if (level==1){
            return ModArmorMaterial.MANA_STONE_ARMOR_1;
        }else if (level==2){
            return ModArmorMaterial.MANA_STONE_ARMOR_2;
        }else if (level==3){
            return ModArmorMaterial.MANA_STONE_ARMOR_3;
        }else if (level==4){
            return ModArmorMaterial.MANA_STONE_ARMOR_4;
        }else if (level==5){
            return ModArmorMaterial.MANA_STONE_ARMOR_5;
        }else if (level==6){
            return ModArmorMaterial.MANA_STONE_ARMOR_6;
        }else if (level==7){
            return ModArmorMaterial.MANA_STONE_ARMOR_7;
        }else if (level==8){
            return ModArmorMaterial.MANA_STONE_ARMOR_8;
        }else if (level==9){
            return ModArmorMaterial.MANA_STONE_ARMOR_9;
        }
        return ModArmorMaterial.MANA_STONE_ARMOR_1;
    }

    private int level = 1;

    public ManaStoneArmor(EquipmentSlotType slot) {
        super(ModArmorMaterial.MANA_STONE_ARMOR_1, slot,
                new Properties().group(YcxzGroup.YCXZ_GROUP)
                        .maxDamage(0).defaultMaxDamage(0));
    }

    public ManaStoneArmor(EquipmentSlotType slot, int level) {
        super(getIArmorMaterial(level), slot,
                new Properties().group(YcxzGroup.YCXZ_GROUP)
                        .maxDamage(0).defaultMaxDamage(0));
        this.level = level;
    }

    public int getLevel() {
        return level;
    }

    @Override
    public boolean isDamageable() {
        return false;
    }

    @Override
    public boolean isDamageable(DamageSource damageSource) {
        return false;
    }

    @Override
    public void addInformation(ItemStack stack, @Nullable World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn) {
        tooltip.add(new StringTextComponent("level: "+this.getLevel()));
    }

}
